﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data;
using System.IO;
using System.Text;

using CE.User;
using CE.Global;
using CE.Report;

public partial class application_download : System.Web.UI.Page
{
    Int64 ProviderId; string Language;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] == null)
        {
            Response.Redirect("ManagementSecureLogin.aspx");
        }
        if (!IsPostBack)
        {
            if (Session["Language"] != null)
            {
                Language = Session["Language"].ToString();
            }
            else
            {
                Language = "EN";
            }
            string val = Request.QueryString["Ref"].ToString();
            int len = val.Length;
            ProviderId = Convert.ToInt64(val.Substring(0, 2));
            Int64 RefId = Convert.ToInt64(val.Substring(4, len - 4));
            string InsType = val.Substring(2, 2);
            string convertno = General.GetRefNumber(RefId);
            string _fileName = "FileName";
            
            string _downloaddate = " : " + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "/" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "/" + CE.Global.General.GetUTCDateTime().Year + " " + CE.Global.General.GetUTCDateTime().ToShortTimeString();  //+CE.Global.General.GetUTCDateTime().Hour.ToString("00") + ":" + CE.Global.General.GetUTCDateTime().Minute.ToString("00") + " " + CE.Global.General.GetUTCDateTime().Ticks;
            if (InsType == "CI")
            {
                if (ProviderId == 11)
                {
                    lblContent.Text = GenerateCIHTML_AZCp(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 12)
                {
                    lblContent.Text = GenerateCIHTML_MSIG(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 16)
                {
                    lblContent.Text = GenerateCIHTML_AXA(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 29)
                {
                    lblContent.Text = GenerateCIHTML_LMG(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 31)
                {
                    lblContent.Text = GenerateCIHTML_Chartis(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 32)
                {
                    lblContent.Text = GenerateCIHTML_BKI(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 33)
                {
                    lblContent.Text = GenerateCIHTML_MTI(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 41)
                {
                    lblContent.Text = GenerateCIHTML_Kurnia(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
                else if (ProviderId == 46)
                {
                    lblContent.Text = GenerateCIHTML_TMS(RefId, InsType);
                    _fileName = GetQuoteRefNo(ProviderId, RefId) + "_" + CE.Global.General.GetUTCDateTime().Day.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Month.ToString("00") + "-" + CE.Global.General.GetUTCDateTime().Year;
                    StringBuilder strText = new StringBuilder("");
                    if (Language == "EN")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>Car Insurance - Application Form</h3></td></tr>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                    else if (Language == "TH")
                    {
                        strText.Append("<table><tr><td colspan='2'><h3>ประกันภัยรถยนต์ - แบบฟอร์ม</h3></td></tr></table>");
                        ExportGridView(_fileName, lblContent);
                        //ExportGridView(_fileName, lblContent, strText.ToString());
                    }
                }
            }
        }
    }

    public string GenerateCIHTML_AXA(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetAXAApplication(RefId, InsType,1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;

            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = ""; 
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";
            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();
            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td align='left'>AXA Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00' align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@' align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00' align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00' align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM' align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM' align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>AXA Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_AZCp(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetAZCpApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = ""; 
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";

            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();

            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>Allianz Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>Allianz Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_BKI(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetBKIApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";

            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();

            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td style='mso-number-format:0' align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td  align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>Bangkok Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>Bangkok Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_Chartis(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetChartisApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";

            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();

            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>Chartis Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>Chartis Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_LMG(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetLMGApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode,Displacement,VehicleWeight,NumberofSeat;

            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";CarPlate = ""; 
            EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";QuoteRefNo = ""; 
            Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";PresentAddress = ""; SubDistrict = "";
            District = ""; Province = ""; PostalCode = ""; Displacement = "";  VehicleWeight = ""; NumberofSeat = "";

            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();

            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }


            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>LMG Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>LMG Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_MSIG(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetMSIGApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";

            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();

            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>MSIG Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>MSIG Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_MTI(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetMTIApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";
            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();
            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>Muang Thai Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>เมืองไทยประกันภัย</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_Kurnia(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetKurniaApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";
            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();
            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'>Kurnia Insurance</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>คูเนียประกันภัย</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public string GenerateCIHTML_TMS(Int64 RefId, string InsType)
    {
        DataSet _dsApplication = new DataSet();
        ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
        _dsApplication = _proposalsummarydb.GetTMSApplication(RefId, InsType, 1);
        string _html = "";
        if (_dsApplication.Tables[0].Rows.Count > 0)
        {

            #region Variable Declaration

            string Title, Name, IdentificationNo, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
            string Accessories, ModifyCost, VehicleType, SumInsured, NCB, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
            string CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment, ApplicationDate;
            string ModifiedDate, CoverType, Beneficiary, PresentAddress, SubDistrict, District, Province, PostalCode, Displacement, VehicleWeight, NumberofSeat;


            Title = ""; Name = ""; IdentificationNo = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
            GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = ""; NCB = "";
            ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = "";
            CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
            QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = ""; Beneficiary = "";
            PresentAddress = ""; SubDistrict = ""; District = ""; Province = ""; PostalCode = ""; Displacement = ""; VehicleWeight = ""; NumberofSeat = "";
            //For Driver
            string DriverName1, DriverDOB1, DriverAge1, DriverLicenseNo1, DriverName2, DriverDOB2, DriverAge2, DriverLicenseNo2;
            string DriverName3, DriverDOB3, DriverAge3, DriverLicenseNo3, DriverName4, DriverDOB4, DriverAge4, DriverLicenseNo4;
            string DriverName5, DriverDOB5, DriverAge5, DriverLicenseNo5;

            DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverLicenseNo1 = "";
            DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverLicenseNo2 = "";
            DriverName3 = ""; DriverDOB3 = ""; DriverAge3 = ""; DriverLicenseNo3 = "";
            DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverLicenseNo4 = "";
            DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = ""; DriverLicenseNo5 = "";

            #endregion

            #region Assign Values

            Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
            if (_dsApplication.Tables[0].Rows[0]["IdentificationNo"] != null)
            {
                IdentificationNo = _dsApplication.Tables[0].Rows[0]["IdentificationNo"].ToString();
            }
            ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
            Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
            DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
            Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
            Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
            NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
            CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
            InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
            GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
            CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
            CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
            Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
            ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
            VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
            SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
            ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
            AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
            AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
            CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
            OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
            LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
            CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
            //EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
            //ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
            CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
            CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
            TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
            PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
            OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
            QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
            Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
            ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
            ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
            CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();
            NCB = _dsApplication.Tables[0].Rows[0]["NCB"].ToString();
            Beneficiary = _dsApplication.Tables[0].Rows[0]["BeneficiaryName"].ToString();
            PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
            SubDistrict = _dsApplication.Tables[0].Rows[0]["SubDistrict"].ToString();
            District = _dsApplication.Tables[0].Rows[0]["District"].ToString();
            Province = _dsApplication.Tables[0].Rows[0]["Province"].ToString();
            PostalCode = _dsApplication.Tables[0].Rows[0]["PostalCode"].ToString();
            if (AddDrivers == "Yes")
            {
                if (_dsApplication.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt16(NoOfDriver) > 0)
                    {
                        DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
                        DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
                        DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
                        DriverLicenseNo1 = _dsApplication.Tables[1].Rows[0]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 1)
                    {

                        DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
                        DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
                        DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
                        DriverLicenseNo2 = _dsApplication.Tables[1].Rows[1]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 2)
                    {
                        DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
                        DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
                        DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
                        DriverLicenseNo3 = _dsApplication.Tables[1].Rows[2]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 3)
                    {
                        DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
                        DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
                        DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
                        DriverLicenseNo4 = _dsApplication.Tables[1].Rows[3]["DrivingLicenseNumber"].ToString();
                    }
                    if (Convert.ToInt16(NoOfDriver) > 4)
                    {
                        DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
                        DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
                        DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
                        DriverLicenseNo5 = _dsApplication.Tables[1].Rows[4]["DrivingLicenseNumber"].ToString();
                    }
                }
            }

            if (_dsApplication.Tables.Count > 2 && _dsApplication.Tables[2].Rows.Count > 0)
            {
                Title = _dsApplication.Tables[2].Rows[0]["Title"].ToString();
                Displacement = _dsApplication.Tables[2].Rows[0]["Dispalcement"].ToString();
                VehicleWeight = _dsApplication.Tables[2].Rows[0]["VehicleWeight"].ToString();
                NumberofSeat = _dsApplication.Tables[2].Rows[0]["NumberofSeat"].ToString();
                EngineNumber = _dsApplication.Tables[2].Rows[0]["EngineNumber"].ToString();
                ChassisNumber = _dsApplication.Tables[2].Rows[0]["ChassisNumber"].ToString();
            }

            #endregion

            #region Generate Excel File
            if (Language == "EN")
            {
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>Applicant Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>Title</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>IdentificationNo</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gender</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Email</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SubDistrict</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>District</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Province</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>PostalCode</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Insurer</b></td><td  align='left'> Tokio marine Srimuang</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Package</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 1st Driver</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 1st Driver</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 2nd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 2nd Driver</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 3rd Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 3rd Driver</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 4th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 4th Driver</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>DOB of 5th Driver</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>Driver License of 5th Driver</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Displacement (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Gross Vehicle Weight (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Number of seat</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Beneficiary</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>License Plate Province</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            else if (Language == "TH")
            {
                //_html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td align='left'>" + CoverType + "</td></tr>";
                //_html += "</table>";
                _html += "<html><body><table width='60%' cellpadding='1' cellspacing='1' border='1'>";
                _html += "<tr><td align='left' colspan='2'><b>รายละเอียดผู้ทำประกัน</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>คำนำหน้า</b></td><td  align='left'>" + Title + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ชื่อผู้ทำประกัน</b></td><td  align='left'>" + Name + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เลขที่บัตรประชาชน</b></td><td style='mso-number-format:0' align='left'>" + IdentificationNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันเกิด</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + DOB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เพศ</b></td><td  align='left'>" + Gender + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>อาชีพ</b></td><td  align='left'>" + Occupation + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>อีเมล์</b></td><td  align='left'>" + Email + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เบอร์ติดต่อ</b></td><td  align='left'>" + ContactNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เบอร์ที่ทำงาน</b></td><td  align='left'>" + OfficePhoneNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ที่อยู่ปัจจุบัน</b></td><td  align='left'>" + PresentAddress + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แขวง/ตำบล</b></td><td  align='left'>" + SubDistrict + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>เขต/อำเภอ</b></td><td  align='left'>" + District + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัด</b></td><td  align='left'>" + Province + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รหัสไปรษณีย์</b></td><td  align='left'>" + PostalCode + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกัน</b></td><td  align='left'>โตเกียวมารีนศรีเมือง</td></tr>";
                _html += "<tr><td width='300' align='left'><b>แพกเก็จ</b></td><td  align='left'>" + CoverType + "</td></tr>";

                _html += "<tr><td width='300' align='left'><b>ระบุผู้ขับขี่</b></td><td  align='left'>" + AddDrivers + "</td></tr>";
                if (AddDrivers == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวนผู้ขับขี่</b></td><td  align='left'>" + NoOfDriver + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 0)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 1</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 1</b></td><td  align='left'>" + DriverName1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 1</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 1</b></td><td  align='left'>" + DriverLicenseNo1 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 1)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 2</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 2</b></td><td  align='left'>" + DriverName2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 2</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 2</b></td><td  align='left'>" + DriverLicenseNo2 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 2)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 3</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 3</b></td><td  align='left'>" + DriverName3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 3</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 3</b></td><td  align='left'>" + DriverLicenseNo3 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 3)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 4</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 4</b></td><td  align='left'>" + DriverName4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 4</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 4</b></td><td  align='left'>" + DriverLicenseNo4 + "</td></tr>";
                }
                if (Convert.ToInt16(NoOfDriver) > 4)
                {
                    //_html += "<tr><td width='300' align='left' colspan='2'><b>ผู้ขับขี่คนที่ 5</b></td></tr>";
                    //_html += "<tr><td width='300' align='left'><b>ชื่อผู้ขับขี่คนที่ 5</b></td><td  align='left'>" + DriverName5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>วันเกิด ผู้ขับขี่คนที่ 5</b></td><td  style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
                    _html += "<tr><td width='300' align='left'><b>เลขที่ใบขับขี่คนที่ 5</b></td><td  align='left'>" + DriverLicenseNo5 + "</td></tr>";
                }

                //_html += "<tr><td width='300' align='left'><b>เลขทะเบียนรถ</b></td><td  align='left'>" + LicenseNo + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                //_html += "<tr><td width='300' align='left' colspan='2'><b>รายละเอียดรถ</b></td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทประกัน</b></td><td  align='left'>" + InsuranceType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทอู่</b></td><td  align='left'>" + GarageType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ปีของรถ</b></td><td  align='left'>" + CarModelYear + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>รุ่น</b></td><td  align='left'>" + CarMakeModel + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ขนาด (cc.)</b></td><td  align='left'>" + Displacement + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>น้ำหนักรถ (kgs)</b></td><td align='left'>" + VehicleWeight + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จำนวนที่นั่ง</b></td><td  align='left'>" + NumberofSeat + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ผู้รับผลประโยชน์</b></td><td  align='left'>" + Beneficiary + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ประเภทรถ</b></td><td  align='left'>" + VehicleType + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทุนประกัน</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + SumInsured + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ส่วนลด NCB</b></td><td  align='left'>" + NCB + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>บริษัทประกันปัจจุบัน</b></td><td  align='left'>" + CurrentInsurer + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>ทะเบียนรถ</b></td><td  align='left'>" + CarPlate + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>จังหวัดที่จดทะเบียน</b></td><td  align='left'>" + ProvinceRegistration + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลขเครื่อง</b></td><td  align='left'>" + EngineNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>หมายเลข Chassis</b></td><td  align='left'>" + ChassisNumber + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>มีอุปกรณ์พิเศษ?</b></td><td  align='left'>" + Accessories + "</td></tr>";
                if (Accessories == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>ราคาของอุปกรณ์พิเศษ</b></td><td  align='left'>" + ModifyCost + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>มีการเคลมปีที่แล้วหรือไม่?</b></td><td>" + AnyClaims + "</td></tr>";
                _html += "<tr><td width='300'  align='left'><b>วันที่เริ่มทำประกัน</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy'  align='left'>" + CommencementDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>เลขที่สั่งซื้อ</b></td><td style='mso-number-format:\\@'  align='left'>" + OrderRefNo + "</td></tr>";
                // _html += "<tr><td width='300' align='left'><b>หมายเลขอ้างอิง</b></td><td  align='left'>" + QuoteRefNo + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>พ.ร.บ.</b></td><td  align='left'>" + CTPL + "</td></tr>";
                if (CTPL == "Yes")
                {
                    _html += "<tr><td width='300' align='left'><b>จำนวน (พ.ร.บ.)</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + CTPLAmount + "</td></tr>";
                }
                _html += "<tr><td width='300' align='left'><b>ราคารวม</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00'  align='left'>" + TotalPremium + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>ประเภทการจ่าย</b></td><td  align='left'>" + PaymentType + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>สถานะการจ่าย</b></td><td  align='left'>" + Payment + "</td></tr>";
                _html += "<tr><td width='300' align='left'><b>วันที่ทำรายการ</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ApplicationDate + "</td></tr>";
                //_html += "<tr><td width='300' align='left'><b>วันที่แก้ไข</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM'  align='left'>" + ModifiedDate + "</td></tr>";

                _html += "</table></body></html>";
            }
            #endregion
        }
        return _html;
    }

    public void ExportGridView(string fileName, Label lblContent, string headerText)
    {
        string attachment = "attachment; filename=" + fileName + ".xls";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/ms-excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        // Create a form to contain the grid
        HtmlForm frm = new HtmlForm();
        frm.InnerHtml = headerText;
        lblContent.Parent.Controls.Add(frm);
        frm.Attributes["runat"] = "server";
        frm.Controls.Add(lblContent);
        frm.RenderControl(htw);
        //GridView1.RenderControl(htw);
        Response.Write(sw.ToString());
        Response.End();
    }

    public void ExportGridView(string fileName, Label lblContent)
    {
        string attachment = "attachment; filename=" + fileName + ".xls";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/ms-excel";
        Response.Write(lblContent.Text);
        Response.End();
    }

    private string GetQuoteRefNo(Int64 ProviderId, Int64 CarId)
    {
        string QuoteRefNo = "";
        string convertno = General.GetRefNumber(CarId);
        if (ProviderId == 11)
        {
            QuoteRefNo = "AZC" + convertno.ToString();
        }
        else if (ProviderId == 12)
        {
            QuoteRefNo = "MSI" + convertno.ToString();
        }
        else if (ProviderId == 16)
        {
            QuoteRefNo = "AXA" + convertno.ToString();
        }
        else if (ProviderId == 29)
        {
            QuoteRefNo = "LMG" + convertno.ToString();
        }
        else if (ProviderId == 31)
        {
            QuoteRefNo = "CTS" + convertno.ToString();
        }
        else if (ProviderId == 32)
        {
            QuoteRefNo = "BKI" + convertno.ToString();
        }
        else if (ProviderId == 33)
        {
            QuoteRefNo = "MTI" + convertno.ToString();
        }
        else if (ProviderId == 41)
        {
            QuoteRefNo = "KUR" + convertno.ToString();
        }
        else if (ProviderId == 46)
        {
            QuoteRefNo = "TMS" + convertno.ToString();
        }
        return QuoteRefNo;
    }

    //public string GenerateCIHTML_MSIG(Int64 RefId, string InsType)
    //{
    //    DataSet _dsApplication = new DataSet();
    //    ProposalSummaryDB _proposalsummarydb = new ProposalSummaryDB();
    //    _dsApplication = _proposalsummarydb.GetMSIGApplication(RefId, InsType);
    //    string _html = "";
    //    if (_dsApplication.Tables[0].Rows.Count > 0)
    //    {

    //        #region Variable Declaration

    //        string Name, ContactNo, Email, DOB, Occupation, Gender, NoOfDriver, CurrentInsurer, InsuranceType, GarageType, CarModelYear, CarMakeModel;
    //        string Accessories, ModifyCost, VehicleType, SumInsured, ProvinceRegistration, AnyClaims, AddDrivers, CommencementDate, OfficePhoneNo, LicenseNo;
    //        string PresentAddress, CarPlate, EngineNumber, ChassisNumber, CTPL, CTPLAmount, TotalPremium, PaymentType, OrderRefNo, QuoteRefNo, Payment;
    //        string ApplicationDate, ModifiedDate, CoverType;

    //        Name = ""; ContactNo = ""; Email = ""; DOB = ""; Occupation = ""; Gender = ""; NoOfDriver = "0"; CurrentInsurer = ""; InsuranceType = "";
    //        GarageType = ""; CarModelYear = ""; CarMakeModel = ""; Accessories = "No"; ModifyCost = ""; VehicleType = ""; SumInsured = "";
    //        ProvinceRegistration = ""; AnyClaims = "No"; AddDrivers = "No"; CommencementDate = ""; OfficePhoneNo = ""; LicenseNo = ""; PresentAddress = "";
    //        CarPlate = ""; EngineNumber = ""; ChassisNumber = ""; CTPL = ""; CTPLAmount = ""; TotalPremium = ""; PaymentType = ""; OrderRefNo = "";
    //        QuoteRefNo = ""; Payment = ""; ApplicationDate = ""; ModifiedDate = ""; CoverType = "";

    //        //For Driver
    //        string DriverName1, DriverDOB1, DriverAge1, DriverName2, DriverDOB2, DriverAge2, DriverName3, DriverDOB3, DriverAge3;
    //        string DriverName4, DriverDOB4, DriverAge4, DriverName5, DriverDOB5, DriverAge5;

    //        DriverName1 = ""; DriverDOB1 = ""; DriverAge1 = ""; DriverName2 = ""; DriverDOB2 = ""; DriverAge2 = ""; DriverName3 = ""; DriverDOB3 = "";
    //        DriverAge3 = ""; DriverName4 = ""; DriverDOB4 = ""; DriverAge4 = ""; DriverName5 = ""; DriverDOB5 = ""; DriverAge5 = "";

    //        #endregion

    //        #region Assign Values

    //        Name = _dsApplication.Tables[0].Rows[0]["Name"].ToString();
    //        ContactNo = _dsApplication.Tables[0].Rows[0]["ContactNo"].ToString();
    //        Email = _dsApplication.Tables[0].Rows[0]["Email"].ToString();
    //        DOB = _dsApplication.Tables[0].Rows[0]["DOB"].ToString();
    //        Occupation = _dsApplication.Tables[0].Rows[0]["Occupation"].ToString();
    //        Gender = _dsApplication.Tables[0].Rows[0]["Gender"].ToString();
    //        NoOfDriver = _dsApplication.Tables[0].Rows[0]["NoOfDriver"].ToString();
    //        CurrentInsurer = _dsApplication.Tables[0].Rows[0]["CurrentInsurer"].ToString();
    //        InsuranceType = _dsApplication.Tables[0].Rows[0]["InsuranceType"].ToString();
    //        GarageType = _dsApplication.Tables[0].Rows[0]["GarageType"].ToString();
    //        CarModelYear = _dsApplication.Tables[0].Rows[0]["CarModelYear"].ToString();
    //        CarMakeModel = _dsApplication.Tables[0].Rows[0]["CarMakeModel"].ToString();
    //        Accessories = _dsApplication.Tables[0].Rows[0]["Accessories"].ToString();
    //        ModifyCost = _dsApplication.Tables[0].Rows[0]["ModifyCost"].ToString();
    //        VehicleType = _dsApplication.Tables[0].Rows[0]["VehicleType"].ToString();
    //        SumInsured = _dsApplication.Tables[0].Rows[0]["SumInsured"].ToString();
    //        ProvinceRegistration = _dsApplication.Tables[0].Rows[0]["ProvinceRegistration"].ToString();
    //        AnyClaims = _dsApplication.Tables[0].Rows[0]["AnyClaims"].ToString();
    //        AddDrivers = _dsApplication.Tables[0].Rows[0]["AddDrivers"].ToString();
    //        CommencementDate = _dsApplication.Tables[0].Rows[0]["CommencementDate"].ToString();
    //        OfficePhoneNo = _dsApplication.Tables[0].Rows[0]["OfficePhoneNo"].ToString();
    //        LicenseNo = _dsApplication.Tables[0].Rows[0]["LicenseNo"].ToString();
    //        PresentAddress = _dsApplication.Tables[0].Rows[0]["PresentAddress"].ToString();
    //        CarPlate = _dsApplication.Tables[0].Rows[0]["CarPlate"].ToString();
    //        EngineNumber = _dsApplication.Tables[0].Rows[0]["EngineNumber"].ToString();
    //        ChassisNumber = _dsApplication.Tables[0].Rows[0]["ChassisNumber"].ToString();
    //        CTPL = _dsApplication.Tables[0].Rows[0]["CTPL"].ToString();
    //        CTPLAmount = _dsApplication.Tables[0].Rows[0]["CTPLAmount"].ToString();
    //        TotalPremium = _dsApplication.Tables[0].Rows[0]["TotalPremium"].ToString();
    //        PaymentType = _dsApplication.Tables[0].Rows[0]["PaymentType"].ToString();
    //        OrderRefNo = _dsApplication.Tables[0].Rows[0]["OrderRefNo"].ToString();
    //        QuoteRefNo = _dsApplication.Tables[0].Rows[0]["QuoteRefNo"].ToString();
    //        Payment = _dsApplication.Tables[0].Rows[0]["Payment"].ToString();
    //        ApplicationDate = _dsApplication.Tables[0].Rows[0]["ApplicationDate"].ToString();
    //        ModifiedDate = _dsApplication.Tables[0].Rows[0]["ModifiedDate"].ToString();
    //        CoverType = _dsApplication.Tables[0].Rows[0]["CoverTypeDesc"].ToString();

    //        if (AddDrivers == "Yes")
    //        {
    //            if (_dsApplication.Tables[1].Rows.Count > 0)
    //            {
    //                if (Convert.ToInt16(NoOfDriver) > 0)
    //                {
    //                    DriverName1 = _dsApplication.Tables[1].Rows[0]["DriverName"].ToString();
    //                    DriverDOB1 = _dsApplication.Tables[1].Rows[0]["DOB"].ToString();
    //                    DriverAge1 = _dsApplication.Tables[1].Rows[0]["Age"].ToString();
    //                }
    //                if (Convert.ToInt16(NoOfDriver) > 1)
    //                {

    //                    DriverName2 = _dsApplication.Tables[1].Rows[1]["DriverName"].ToString();
    //                    DriverDOB2 = _dsApplication.Tables[1].Rows[1]["DOB"].ToString();
    //                    DriverAge2 = _dsApplication.Tables[1].Rows[1]["Age"].ToString();
    //                }
    //                if (Convert.ToInt16(NoOfDriver) > 2)
    //                {
    //                    DriverName3 = _dsApplication.Tables[1].Rows[2]["DriverName"].ToString();
    //                    DriverDOB3 = _dsApplication.Tables[1].Rows[2]["DOB"].ToString();
    //                    DriverAge3 = _dsApplication.Tables[1].Rows[2]["Age"].ToString();
    //                }
    //                if (Convert.ToInt16(NoOfDriver) > 3)
    //                {
    //                    DriverName4 = _dsApplication.Tables[1].Rows[3]["DriverName"].ToString();
    //                    DriverDOB4 = _dsApplication.Tables[1].Rows[3]["DOB"].ToString();
    //                    DriverAge4 = _dsApplication.Tables[1].Rows[3]["Age"].ToString();
    //                }
    //                if (Convert.ToInt16(NoOfDriver) > 4)
    //                {
    //                    DriverName5 = _dsApplication.Tables[1].Rows[4]["DriverName"].ToString();
    //                    DriverDOB5 = _dsApplication.Tables[1].Rows[4]["DOB"].ToString();
    //                    DriverAge5 = _dsApplication.Tables[1].Rows[4]["Age"].ToString();
    //                }
    //            }
    //        }


    //        #endregion

    //        #region Generate Excel File
    //        _html = "<table width='75%' cellpadding='1' cellspacing='1' border='0'>";
    //        _html += "<tr><td width='300' align='left'><b>CoverType</b></td><td align='left'>" + CoverType + "</td></tr>";
    //        _html += "</table>";
    //        _html += "<table width='75%' cellpadding='1' cellspacing='1' border='1'>";
    //        _html += "<tr><td width='300' align='left' colspan='2'><b>Applicant Details</b></td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Applicant Name</b></td><td align='left'>" + Name + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DOB + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Gender</b></td><td align='left'>" + Gender + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Occupation</b></td><td align='left'>" + Occupation + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Email</b></td><td align='left'>" + Email + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>ContactNo</b></td><td align='left'>" + ContactNo + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>OfficePhoneNo</b></td><td align='left'>" + OfficePhoneNo + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>PresentAddress</b></td><td align='left'>" + PresentAddress + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>LicenseNo</b></td><td align='left'>" + LicenseNo + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>ProvinceRegistration</b></td><td align='left'>" + ProvinceRegistration + "</td></tr>";
    //        _html += "<tr><td width='300' align='left' colspan='2'><b>Car and Policy Details</b></td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>InsuranceType</b></td><td align='left'>" + InsuranceType + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>GarageType</b></td><td align='left'>" + GarageType + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>CarModelYear</b></td><td align='left'>" + CarModelYear + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>CarMakeModel</b></td><td align='left'>" + CarMakeModel + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>VehicleType</b></td><td align='left'>" + VehicleType + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>SumInsured</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00' align='left'>" + SumInsured + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>CurrentInsurer</b></td><td align='left'>" + CurrentInsurer + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>CarPlate</b></td><td align='left'>" + CarPlate + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>EngineNumber</b></td><td align='left'>" + EngineNumber + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>ChassisNumber</b></td><td align='left'>" + ChassisNumber + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Added Accessories Or Modifications?</b></td><td align='left'>" + Accessories + "</td></tr>";
    //        if (Accessories == "Yes")
    //        {
    //            _html += "<tr><td width='300' align='left'><b>Accessories or Modifications Cost</b></td><td align='left'>" + ModifyCost + "</td></tr>";
    //        }
    //        _html += "<tr><td width='300' align='left'><b>Any Claims in the Last Year?</b></td><td>" + AnyClaims + "</td></tr>";
    //        _html += "<tr><td width='300'  align='left'><b>CommencementDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + CommencementDate + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>OrderRefNo</b></td><td style='mso-number-format:\\@' align='left'>" + OrderRefNo + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>QuoteRefNo</b></td><td align='left'>" + QuoteRefNo + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>CTPL</b></td><td align='left'>" + CTPL + "</td></tr>";
    //        if (CTPL == "Yes")
    //        {
    //            _html += "<tr><td width='300' align='left'><b>CTPL Amount</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00' align='left'>" + CTPLAmount + "</td></tr>";
    //        }
    //        _html += "<tr><td width='300' align='left'><b>Premium</b></td><td style='mso-number-format:\\#\\,\\#\\#0\\.00' align='left'>" + TotalPremium + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>PaymentType</b></td><td align='left'>" + PaymentType + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Payment Status</b></td><td align='left'>" + Payment + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>ApplicationDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM' align='left'>" + ApplicationDate + "</td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>ModifiedDate</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy\\ hh\\:mm\\ AM\\/PM' align='left'>" + ModifiedDate + "</td></tr>";
    //        _html += "<tr><td width='300' align='left' colspan='2'><b>Driver Details</b></td></tr>";
    //        _html += "<tr><td width='300' align='left'><b>Specify Named Driver</b></td><td align='left'>" + AddDrivers + "</td></tr>";
    //        if (AddDrivers == "Yes")
    //        {
    //            _html += "<tr><td width='300' align='left'><b>Number Of Named Driver</b></td><td align='left'>" + NoOfDriver + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(NoOfDriver) > 0)
    //        {
    //            _html += "<tr><td width='300' align='left' colspan='2'><b>Driver 1</b></td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName1 + "</td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Drover DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB1 + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(NoOfDriver) > 1)
    //        {
    //            _html += "<tr><td width='300' align='left' colspan='2'><b>Driver 2</b></td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName2 + "</td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Drover DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB2 + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(NoOfDriver) > 2)
    //        {
    //            _html += "<tr><td width='300' align='left' colspan='2'><b>Driver 3</b></td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName3 + "</td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Drover DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB3 + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(NoOfDriver) > 3)
    //        {
    //            _html += "<tr><td width='300' align='left' colspan='2'><b>Driver 4</b></td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName4 + "</td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Drover DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB4 + "</td></tr>";
    //        }
    //        if (Convert.ToInt16(NoOfDriver) > 4)
    //        {
    //            _html += "<tr><td width='300' align='left' colspan='2'><b>Driver 5</b></td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Driver Name</b></td><td align='left'>" + DriverName5 + "</td></tr>";
    //            _html += "<tr><td width='300' align='left'><b>Drover DOB</b></td><td style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + DriverDOB5 + "</td></tr>";
    //        }
    //        _html += "</table>";


    //        #endregion
    //    }
    //    return _html;
    //}
    
}
